function validate()
{
	if (document.addDiscountPlan.name.value == "")
	{
		alert("Please enter a discount plan name.");
		return false;
	}

	if (document.addDiscountPlan.rate.value == "")
	{
		alert("Please enter a discount rate.");
		return false;
	}
	
	if (document.addDiscountPlan.startDay.value == document.addDiscountPlan.endDay.value
			&& document.addDiscountPlan.startHour.value == document.addDiscountPlan.endHour.value
			&& document.addDiscountPlan.startMinute.value == document.addDiscountPlan.endMinute.value)
	{
		alert("The start and end times are identical. Please change one of them.");
		return false;
	}
	
	var currency = /^\d*\.\d{0,2}$/;
	var currency2 = /^\d+$/;
	if (!currency.test(document.addDiscountPlan.rate.value) &&
			!currency2.test(document.addDiscountPlan.rate.value) ||
			document.addDiscountPlan.rate.value == 0)
	{
		alert("Discount rate entered incorrectly.");
		return false;
	}

	return true;
}